﻿package com.translation.android.database;

import java.util.Map;

/**
 * 单词的扫描结果的过滤器类
 * @author 李伟豪
 *
 */
public class WordResultFilter implements IWordResult{
	private String result;
//	private Map<Object, Object> filterMap;
	private static String[][] filter = { 
		{ "1", "l" }, 
		{ "L1", "u" }, 
		{ "11", "n" },
		{ "[1", "n" }, 
		{ "[]", "n" },
		{ "1f", "r" },
		{ "€",  "e" },
		{ "c-",  "e" },
		{ "&",  "" }
	}; 
	
	
	public WordResultFilter(String result){
		this.result = result.trim();
	}
	
	
	@Override
	public String wordResultFilter() {
		//处理扫描结果逻辑
		String str = result;
		//int size = filterMap.size();
		int size = filter.length;
		for(int i = 0 ; i < size ; i++){
			//匹配关键词
			if(result.contains(filter[i][0])){
				str = str.replaceAll(filter[i][0], filter[i][1]);
			}
		}
			
		return str.toLowerCase();
	}
	
}
